<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .router-link-active{
            color:orange;
            font-size: 28px;
            font-weight: bold;
            text-decoration: none;
        }
    </style>
</head>
<script src="vue.js"></script>
<script src="vue-router.js"></script>
<body>
    <div id="app">
        <router-link to="login">登录</router-link>
        <router-link to="reg">注册</router-link>
        <router-view></router-view>
    </div>
    <script>
        var login ={
            template:'<h1>这是登录组件</h1>'
        };
        var reg = {
            template:'<h1>这是注册组件</h1>'
        };

        const router  = new VueRouter({
            routes:[
                {path:'/login',component:login},
                {path:'/reg',component:reg},
                {path:'/',redirect:'/login'}
                // 路由重定向
                // Resonse.Redirect("")
            ],
            linkActiveClass:'my-active' //自定义router-link激活类的名字
            
        })
        var vm = new Vue({
            el:'#app',
            router:router,
        })
    </script>
</body>
</html>